package com.kldy8.kldyw.find.script.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/9/18.
 */
public class ScripTypes
{
    public String title;
    public List<Category> categoryList = new ArrayList<Category>();

    public class Category
    {
        public int category_id;
        public String name;
        public String type;
    }

    public void resolution(JSONObject jsonObject)
    {
        if (jsonObject == null)
        {
            return ;
        }
        this.title = jsonObject.optString("title");

        JSONArray array =  jsonObject.optJSONArray("category");
        if (array!=null)
        {
            for (int i = 0; i < array.length(); i++)
            {
                JSONObject jsonSon = array.optJSONObject(i);
                Category category = new Category();
                category.category_id = jsonSon.optInt("category_id");
                category.name = jsonSon.optString("name");
                category.type = jsonSon.optString("type");
                categoryList.add(category);
            }
        }
    }

}
